package com.demo.yuanzi.service.impl;

import com.demo.yuanzi.dao.YaunziSaRolePermissionDao;
import com.demo.yuanzi.entity.YaunziSaRolePermission;
import com.demo.yuanzi.service.YaunziSaRolePermissionService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;

/**
 * (YaunziSaRolePermission)表服务实现类
 *
 * @author makejava
 * @since 2024-05-09 14:16:56
 */
@Service
public class YaunziSaRolePermissionServiceImpl implements YaunziSaRolePermissionService {
    @Resource
    private YaunziSaRolePermissionDao yaunziSaRolePermissionDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public YaunziSaRolePermission queryById(Integer id) {
        return this.yaunziSaRolePermissionDao.queryById(id);
    }



    /**
     * 新增数据
     *
     * @param yaunziSaRolePermission 实例对象
     * @return 实例对象
     */
    @Override
    public YaunziSaRolePermission insert(YaunziSaRolePermission yaunziSaRolePermission) {
        this.yaunziSaRolePermissionDao.insert(yaunziSaRolePermission);
        return yaunziSaRolePermission;
    }

    /**
     * 修改数据
     *
     * @param yaunziSaRolePermission 实例对象
     * @return 实例对象
     */
    @Override
    public YaunziSaRolePermission update(YaunziSaRolePermission yaunziSaRolePermission) {
        this.yaunziSaRolePermissionDao.update(yaunziSaRolePermission);
        return this.queryById(yaunziSaRolePermission.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.yaunziSaRolePermissionDao.deleteById(id) > 0;
    }
}
